home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Development Tools & Languages / Macintosh Common Lisp Related / interfaces / PInterface Translator / PInterfaces / Aliases.p < prev    next >
Encoding:
Text File  |  1993-09-16  |  4.9 KB  |  141 lines  |  [TEXT/MPS ]

  1. {
  2. Created: Monday, January 28, 1991 at 1:26 PM
  3.     Aliases.p
  4.     Pascal Interface to the Macintosh Libraries
  5.  
  6.         Copyright Apple Computer, Inc.    1989-1990
  7.         All rights reserved
  8. }
  9.  
  10.  
  11. {$IFC UNDEFINED UsingIncludes}
  12. {$SETC UsingIncludes := 0}
  13. {$ENDC}
  14.  
  15. {$IFC NOT UsingIncludes}
  16.     UNIT Aliases;
  17.     INTERFACE
  18. {$ENDC}
  19.  
  20. {$IFC UNDEFINED UsingAliases}
  21. {$SETC UsingAliases := 1}
  22.  
  23. {$I+}
  24. {$SETC AliasesIncludes := UsingIncludes}
  25. {$SETC UsingIncludes := 1}
  26. {$IFC UNDEFINED UsingTypes}
  27. {$I $$Shell(PInterfaces)Types.p}
  28. {$ENDC}
  29. {$IFC UNDEFINED UsingDialogs}
  30. {$I $$Shell(PInterfaces)Dialogs.p}
  31. {$ENDC}
  32. {$IFC UNDEFINED UsingAppleTalk}
  33. {$I $$Shell(PInterfaces)AppleTalk.p}
  34. {$ENDC}
  35. {$IFC UNDEFINED UsingFiles}
  36. {$I $$Shell(PInterfaces)Files.p}
  37. {$ENDC}
  38. {$SETC UsingIncludes := AliasesIncludes}
  39.  
  40. CONST
  41. rAliasType = 'alis';                { Aliases are stored as resources of this type }
  42.  
  43. { define alias resolution action rules mask }
  44. kARMMountVol = $00000001;           { mount the volume automatically }
  45. kARMNoUI = $00000002;               { no user interface allowed during resolution }
  46. kARMMultVols = $00000008;           { search on multiple volumes }
  47. kARMSearch = $00000100;             { search quickly }
  48. kARMSearchMore = $00000200;         { search further }
  49. kARMSearchRelFirst = $00000400;     { search target on a relative path first }
  50.  
  51. { define alias record information types }
  52. asiZoneName = -3;                   { get zone name }
  53. asiServerName = -2;                 { get server name }
  54. asiVolumeName = -1;                 { get volume name }
  55. asiAliasName = 0;                   { get aliased file/folder/volume name }
  56. asiParentName = 1;                  { get parent folder name }
  57.  
  58.  
  59. TYPE
  60. { define the alias record that will be the blackbox for the caller }
  61. AliasPtr = ^AliasRecord;
  62. AliasHandle = ^AliasPtr;
  63. AliasRecord = RECORD
  64.     userType: OSType;               { appl stored type like creator type }
  65.     aliasSize: INTEGER;             { alias record size in bytes, for appl usage }
  66.     END;
  67.  
  68.  
  69. AliasInfoType = INTEGER;            { alias record information type }
  70. AliasFilterProcPtr = ProcPtr;
  71.  
  72.  
  73. {  create a new alias between fromFile-target and return alias record handle  }
  74. FUNCTION NewAlias(fromFile: FSSpecPtr;
  75.                   target: FSSpec;
  76.                   VAR alias: AliasHandle): OSErr;
  77.     INLINE $7002,$A823;
  78.  
  79. { create a minimal new alias for a target and return alias record handle }
  80. FUNCTION NewAliasMinimal(target: FSSpec;
  81.                          VAR alias: AliasHandle): OSErr;
  82.     INLINE $7008,$A823;
  83.  
  84. { create a minimal new alias from a target fullpath (optional zone and server name) and return alias record handle  }
  85. FUNCTION NewAliasMinimalFromFullPath(fullPathLength: INTEGER;
  86.                                      fullPath: Ptr;
  87.                                      zoneName: Str32;
  88.                                      serverName: Str31;
  89.                                      VAR alias: AliasHandle): OSErr;
  90.     INLINE $7009,$A823;
  91.  
  92. { given an alias handle and fromFile, resolve the alias, update the alias record and return aliased filename and wasChanged flag. }
  93. FUNCTION ResolveAlias(fromFile: FSSpecPtr;
  94.                       alias: AliasHandle;
  95.                       VAR target: FSSpec;
  96.                       VAR wasChanged: BOOLEAN): OSErr;
  97.     INLINE $7003,$A823;
  98.  
  99. { given an alias handle and an index specifying requested alias information type, return the information from alias record as a string. }
  100. FUNCTION GetAliasInfo(alias: AliasHandle;
  101.                       index: AliasInfoType;
  102.                       VAR theString: Str63): OSErr;
  103.     INLINE $7007,$A823;
  104.  
  105. {  given a file spec, return target file spec if input file spec is an alias.
  106.     It resolves the entire alias chain or one step of the chain.  It returns
  107.     info about whether the target is a folder or file; and whether the input
  108.     file spec was an alias or not.  }
  109. FUNCTION ResolveAliasFile(VAR theSpec: FSSpec;
  110.                           resolveAliasChains: BOOLEAN;
  111.                           VAR targetIsFolder: BOOLEAN;
  112.                           VAR wasAliased: BOOLEAN): OSErr;
  113.     INLINE $700C,$A823;
  114.  
  115. {   Low Level Routines 
  116. given an alias handle and fromFile, match the alias and return aliased filename(s) and needsUpdate flag }
  117. FUNCTION MatchAlias(fromFile: FSSpecPtr;
  118.                     rulesMask: LONGINT;
  119.                     alias: AliasHandle;
  120.                     VAR aliasCount: INTEGER;
  121.                     aliasList: FSSpecArrayPtr;
  122.                     VAR needsUpdate: BOOLEAN;
  123.                     aliasFilter: AliasFilterProcPtr;
  124.                     yourDataPtr: UNIV Ptr): OSErr;
  125.     INLINE $7005,$A823;
  126.  
  127. { given a fromFile-target pair and an alias handle, update the lias record pointed to by alias handle to represent target as the new alias. }
  128. FUNCTION UpdateAlias(fromFile: FSSpecPtr;
  129.                      target: FSSpec;
  130.                      alias: AliasHandle;
  131.                      VAR wasChanged: BOOLEAN): OSErr;
  132.     INLINE $7006,$A823;
  133.  
  134.  
  135. {$ENDC}    { UsingAliases }
  136.  
  137. {$IFC NOT UsingIncludes}
  138.     END.
  139. {$ENDC}
  140.  
  141.